﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="quickplotpanel.aspx.cs" Inherits="IGIS.quickplotpanel" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <title>הדפסה מותאמת אישית</title>
      <script type="text/javascript" src="Scripts/jquery-1.4.1.min.js"></script>
       <script type="text/javascript" src="Scripts/legendbuilder.js"></script>
         <script type="text/javascript" src="Scripts/quickplotpanel.js"></script>
          
 
      <link rel="stylesheet" href="../viewerfiles/viewer.css" type="text/css">
        <style type="text/css">
          table#Ui
          {
          font-family: Arial;
          direction:rtl;
          }
          span.Title
          {
          font-size: 12pt;
          }
          td#MainTitle
          {
          font-size: 15pt;
          font-weight: bold;
          }
          tr#RegText
          {
          font-size: 10pt;
          margin-bottom: 10px;
          height: 22px;
          }
          tr#Underline
          {
          background-color: gray;
          height: 2px;
          }
          tr#Spacer
          {
          height: 6px;
          }
          td#HelpText
          {
          background-color: #FFEED5;
          border: #FFCC33 1px solid;
          color: #666666;
          font-size: 10pt;
          }
          td#fldCell
          {
          padding-right: 10;
          }
          input.Btn
          {
          width: 95px;
          }
          font#RegText
          {
          font-size: 10pt;
          margin-right: 10px;
          height: 22px;
          }
          select
          {
          font-size: 10pt;
          margin-bottom: 11px;
          }
 
        </style>
        
    


      </head>
      

  <body dir="rtl" class="PrintablePage"   topmargin="7" bottommargin="0" leftmargin="7" rightmargin="7" marginwidth="7"   >
    <table id="Ui" width="100%%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td id="MainTitle"> הדפסה מותאמת אישית</td>
      </tr>
      <tr id="Spacer">
        <td></td>
      </tr>
      <tr id="Underline">
        <td></td>
      </tr>
      <tr id="Spacer">
        <td></td>
      </tr>
      <tr id="Spacer">
        <td></td>
      </tr>
      <tr>
        <td id="HelpText">בחר את המרכיבים שיכללו בהדפסה</td>
      </tr>
      <tr id="Spacer">
        <td></td>
      </tr>
      <tr id="RegText">
        <td>
          <input type="checkbox" id="isTitle" checked=""> כותרת עמוד
        </td>
      </tr>
      <tr>
        <td id="fldCell">
          <Font id="RegText">כותרת ימנית:</Font> <input type="edit" id="Fld">
        </td>
      </tr>
      <tr>
        <td id="fldCell">
          <Font id="RegText">כותרת שמאלית:</Font> <input type="edit" id="FldName" value="">
	  <!--Font id="RegText">המפיק:</Font> <input type="edit" id="FldName" value="ועדה לתכנון ובנייה גבעות - אלונים"-->
        </td>
      </tr>
      <tr id="RegText">
        <td>
          <input type="checkbox" id="isLegend" checked="">מיקרא
        </td>
      </tr>
      <!--tr id="RegText">
        <td>
          <input type="checkbox" id="isMinimap" checked=""> מפת התמצאות
        </td>
      </tr-->
      <tr id="RegText">
        <td>
          <input type="checkbox" id="isLogo" checked=""> לוגו + קנ''מ
        </td>
      </tr>
      <tr id="RegText" style="display:none;">
        <td>
          <input type="checkbox" id="isArrow" checked=""> חץ צפון
        </td>
      </tr>
       <!--tr id="RegText">
        <td>
          <input type="checkbox" id="isScale" checked=""> סרגל קנמ
        </td>
      </tr-->
      <tr id="RegText">
        <td>
          <input type="checkbox" id="isFrame" checked="">רשת פנימית במפה
        </td>
      </tr>
      <tr id="Spacer">
        <td></td>
      </tr>
      <tr id="RegText">
        <td id="fldCell">
          <input id="netType" type="radio" value="coord" checked/> רשת קואורדינטות
          <input id="netType" type="radio" value="report"/>רשת דיווח
        </td>
      </tr>
      <tr id="Spacer">
        <td></td>
      </tr>
      <tr>
        <td id="HelpText"> הגדרות נייר המפה</td>
      </tr>
      <tr id="Spacer">
        <td></td>
      </tr>
      <tr id="RegText">
        <td>
          <table id="Ui">
            <tr id="RegText"><td width=100>גודל הנייר</td><td width=100>קנ"מ</td><td width=100>DPI</td></tr>
            <tr>
              <td>
              <select id=lPaper><option value="4">A 4</option><option value="3">A 3</option><option value="2">A 2</option><option value="1">A 1</option><option value="0">A 0</option></select>
              <td><select dir=rtl id="ScalingList">
             
              </select>

              
            </td>
            <td>
            <select class="FixWidth" id="DPIList">
                <option value="96" selected>96</option>
                <option value="150" >150</option>
                <option value="300">300</option>
                <option value="600">600</option>
            </select>
          
            </td>

            <select class="FixWidth" id="PaperList" onchange="drawCaptureBox(this)" style="visibility:hidden;">
                <option value="297.0,210.0">A4 (210 MM x 297 MM)</option>
                <option value="420.0,297.0">A3 (297 MM) x 420 MM</option>
                 <option value="420.0,594.0">A2 (594 x 420 MM )</option>
                  <option value="841.0,594.0">A1 (841 x 594 MM )</option>
                   <option value="1189.0,594.0">A0 (1189 x 841 mm )</option>

               
                <option value="279.4,215.9">Letter (8.50 x 11.00 Inches)</option>
                <option value="355.6,215.9">Legal (8.50 x 14.00 Inches)</option>
            </select>
      

              <input type="hidden" id="ScaleDenominator" name="scale_denominator" />
            </tr>
          </table>
        </td>
      </tr>
      <tr id="Spacer">
        <td></td>
      </tr>
      <tr id="RegText">
        <td id="fldCell">
          כיוון הנייר<br>
          <input id='portrait' name="PaperLayout" type="radio" value="portrait" checked> לאורך
          <input id="lanscape" name="PaperLayout" type="radio" value="lanscape"> לרוחב
        </td>
      </tr>
      <tr id="Spacer">
        <td></td>
      </tr>
      <tr id="Spacer">
        <td></td>
      </tr>
      <tr id="Underline">
        <td></td>
      </tr>
      <tr id="Spacer">
        <td></td>
      </tr>
      <tr id="Spacer">
        <td></td>
      </tr>
      <tr id="RegText">
        <td>
          <input class="Btn" type="button" value=" ליצירת המפה" onClick="GetPrintablePage()">
          <input class="Btn" type="button" value="ביטול" id="back" onClick="GoBack()" style="visibility: "></td>
      </tr>
    </table>
 



      <script type="text/javascript">

       $(document).ready(function() {
       InitDocument2();
  // Handler for .ready() called.
  /*alert(getScale());*/
     $("#lPaper").change(function() { /* do something here */ 
     
    // change selected papaer list
    /*
    
      <select class="FixWidth" id="PaperList" onchange="drawCaptureBox(this)" style="visibility:hidden;">
                <option value="297.0,210.0">A4 (210 MM x 297 MM)</option>
                <option value="420.0,297.0">A3 (297 MM) x 420 MM</option>
                <option value="279.4,215.9">Letter (8.50 x 11.00 Inches)</option>
                <option value="355.6,215.9">Legal (8.50 x 14.00 Inches)</option>
            </select>
            <select id=Select1><option value="4">A 4</option><option value="3">A 3</option><option value="2">A 2</option><option value="1">A 1</option><option value="0">A 0</option></select>
            */
     if($("#lPaper").val()=="4" )  $("#PaperList").val("297.0,210.0"); 
     if($("#lPaper").val()=="3" )  $("#PaperList").val("420.0,297.0"); 
     //594 x 420 mm
     if($("#lPaper").val()=="2" )  $("#PaperList").val("420.0,594.0"); 
     if($("#lPaper").val()=="1" )  $("#PaperList").val("841.0,594.0"); 
       if($("#lPaper").val()=="0" )  $("#PaperList").val("1189.0,594.0"); 
     })

  var width =GetParent().GetMapFrame().GetMapWidth();
	var height = GetParent().GetMapFrame().GetMapHeight();
    
  //  alert("scale: "+scalee);
	
//	    alert("לא ניתן להציג שטח הדפסה לקנ''מ הנבחר , יש להתרחק במפה");
//	    document.getElementById("DoGrid").disabled = true;


  var center = GetParent().GetMapFrame().GetCenter();
      /*  if (this.captureBox != null)
        {
            center = this.captureBox.getCentroid();
        }*/
        var centerX = (GetParent().GetMapFrame().extX1 + GetParent().GetMapFrame().extX2) / 2;
        var centerY = (GetParent().GetMapFrame().extY2 + GetParent().GetMapFrame().extY1) / 2;
       //     ZoomToView(center.x, center.y, scale, 1);

  /*alert("centerx"+centerX +"parent == center.x +" +GetParent()..GetMapFrame().center.x);
    alert("centery"+centerY +"parent == center.y +" +GetParent().GetMapFrame().center.y);*/

    });
          var popup = <%=popup %>;
          var width = <%=clientWidth %>;
          var sessionId = '<%=sessionId %>';
          var mapName ='<%= mapName%>';
         
          var scale = getScale();
          var centerX = (GetParent().GetMapFrame().extX1 + GetParent().GetMapFrame().extX2) / 2;
          var centerY = (GetParent().GetMapFrame().extY2 + GetParent().GetMapFrame().extY1) / 2;
          var dpi ="";

          function InitDocument()
          {
          /*alert("test");*/
          }
          function InitDocument2()
          {
          //debugger;
		
          /*if(!popup)
          {
          document.onmousedown = OnMouseDown;
          document.getElementById("back").style.visibility = "visible";
          }*/
          var fldCell = document.getElementById("fldCell");

          var lstScale = document.getElementById("ScalingList");
          var strscale = new String(scale+','+"500,1000,1250,1500,2000,2500,3000,5000,10000");
          var arrscale = strscale.split(',');
          for(var i = 0; i <arrscale.length; i++){
              var opt = document.createElement("OPTION");
              opt.value=parseInt(arrscale[i]);
              opt.text='1: '+ parseInt(arrscale[i]);
              lstScale.add(opt);
            }



          /*var field = document.getElementById("FldName");
          field.style.width = (fldCell.offsetWidth - 30) + "px";
          field.style.position = "relative";

          field = document.getElementById("Fld");
          field.style.width = (fldCell.offsetWidth - 30) + "px";
          field.style.position = "relative";
          //field.style.left = "25px";
          //field.value = mapName;
          field.focus();*/
          }

          function OnMouseDown(e)
          {
          GetParent().ForwardMouseDown(document, e);
          }

          function GetParent()
          {
          if(popup)
          return opener;
          else
          return parent.parent;
          }

          function GetPrintablePage()
          {
	/*	 alert("GetPrintablePage");*/
            dpi= document.getElementById("DPIList").value;
          var tname = document.getElementById("FldName").value;
          var title = document.getElementById("Fld").value;
          scale=document.getElementById("ScalingList").value;
          var win = window.open("printablepage.aspx?SESSION=" + sessionId + "&MAPNAME=" + encodeURIComponent(mapName) + "&TITLE=" + encodeURIComponent(title) + "&DPI=" + dpi + "&SCALE=" + scale +
          "&CENTERX=" + centerX + "&CENTERY=" + centerY +
          "&ISTITLE=" + (document.getElementById("isTitle").checked? "1":"0") +
          "&ISLEGEND=" + (document.getElementById("isLegend").checked? "1":"0") + 
         /* "&ISMINIMAP=" + (document.getElementById("isMinimap").checked? "1":"0") + */
          "&ISLOGO=" + (document.getElementById("isLogo").checked? "1":"0") + 
          "&ISARROW=" + (document.getElementById("isArrow").checked? "1":"0") +
          "&TITLE_NAME=" + encodeURIComponent(tname) +
          "&ISFRAME=" + (document.getElementById("isFrame").checked? "1":"0") +
          "&NETTYPE=" + encodeURIComponent(document.getElementById("netType").value)+
          "&PAPERSIZE=" + document.getElementById("lPaper").value +
          "&PAPERSCALE=" + document.getElementById("ScalingList").value +
          "&PAPERORIENTATION=" + encodeURIComponent(document.getElementById("portrait").checked? "portrait":"lanscape") + 
         // "&HIDELAYER="+GetParent().mapFrame.hiddenLayers + //Added for minimap script
		/*  "&MINIMAPIMAGEURL=" + encodeURIComponent(GetParent().mapFrame.minimap.GenerateImageUrl(150, 130)) + //Added for minimap script*/
		  "&LEGEND="+encodeURIComponent("<%= legend %>"),
          "", "width=690,height=660,resizable=yes,scrollbars=yes,toolbar, menubar");
          if(win != null)
          win.focus();
          }

          function GoBack()
          {
          GetParent().GotoHomePage();
          }
          
      </script>


  </body>
</html>
